﻿using WebService.Models;

namespace WebService.Authorize
{
    public interface IChecker
    {
        void ProcessUser(HttpContext httpContext,
            Action<CommonAuthUser> success, Action<string> failed, Action<string> noAccess);
    }

    public static class CommonAuthUserExt
    {
        public static IChecker GetChecker(this CommonAuthUser authUser)
        {
            return authUser.Type switch
            {
                IdentityType.Platform => null,
                IdentityType.System => new SystemUserChecker(authUser.Id, authUser.PId),
                //IdentityType.Customer => new CustomerChecker(authUser.Id, authUser.PId),
                //IdentityType.PIdOnly => new PIdChecker(authUser.PId),
                //IdentityType.Station => new StationChecker(authUser),
                _ => null,
            };
        }
    }
}
